package cn.itsource.campus.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/session")
public class SessionController {

    @GetMapping("/addSession")
    public void addSession(HttpSession session){
        System.out.println("AAAAAAAA");
        session.setAttribute("username","张三");
    }


    @GetMapping("/getSessionValue")
    public void getSessionValue(HttpSession session){
        Object username = session.getAttribute("username");
        System.out.println(username);
    }
}
